//
//  HomeDialogViewModel.swift
//  Chatup
//
//  Created by op on 2023/10/19.
//

import Foundation

struct HomeDialogModel:Identifiable{
    var id :Int
    var name:String
    var desc:String
    var image:String
    init(name: String, desc: String, image: String, id: Int) {
        self.name = name
        self.desc = desc
        self.image = image
        self.id = id
    }
}

@MainActor
class HomeDialogViewModel:ObservableObject{
    @Published var items:[HomeDialogModel] = []
    
    init(){
        let roles = RoleDataManager.share.getRoles()
        items = roles.filter({ role in
            return role.id != 0
        }).map({ role in
            return HomeDialogModel.init(name: role.name, desc: role.i18nDesc(), image: role.icon,id: role.serverId)
        })

    }
}
